package com.hns.can.master.enumrate;

public enum ColorCode {
	
	COLOR_1(1,"胎压故障", "#ff0000"),
	COLOR_2(2, "发动机故障", "#ff9900"),
	COLOR_3(3, "车身故障", "#ffff00"),
	COLOR_4(4, "缓速器故障", "#00ff00"),
	COLOR_5(5, "集中润滑故障", "#00ffff"),
	COLOR_6(6, "空调故障", "#4a86e8"),
	COLOR_7(7, "ECAS系统故障", "#0000ff"),
	COLOR_8(8, "BMS故障", "#9900ff"),
	COLOR_9(9, "HCU故障", "#ff00ff"),
	COLOR_10(10, "DMC故障", "#e6b8af"),
	COLOR_11(11, "电池故障", "#f4cccc"),
	COLOR_12(12, "BMU通信", "#fce5cd"),
	COLOR_13(13, "电机控制器故障", "#d9ead3"),
	COLOR_14(14, "变速箱故障", "#dd7e6b"),
	COLOR_15(15, "电容故障", "#ea9999"),
	COLOR_16(16, "整车控制器HCU", "#cc4125"),
	COLOR_17(17, "打气泵电机电源", "#e06666"),
	COLOR_18(18, "转向电机电源", "#ffd966"),
	COLOR_19(19, "DC/DC", "#783f04"),
	COLOR_20(20, "绝缘检测系统", "#274e13"),
	COLOR_99(99, "未知故障", "#434343");
	
	private ColorCode(int colorNum, String FaultKey, String code){
		this.colorNum = colorNum;
		this.FaultKey = FaultKey;
		this.code = code;
	}
	
	private final int colorNum;
	private final String FaultKey;
	private final String code;
	
	public String getCode() {
		return code;
	}
	
	public int getColorNum() {
		return colorNum;
	}
	
	public String getFaultKey() {
		return FaultKey;
	}
	public static String getCodeByNum(int colorNum){
		for(ColorCode c : ColorCode.values()){
			if(c.getColorNum() == colorNum){
				return c.getCode();
			}
		}
		return null;
	}
	
	public static String getCodeByFault(String FaultKey){
		for(ColorCode c : ColorCode.values()){
			if(c.getFaultKey().equals(FaultKey)){
				return c.getCode();
			}
		}
		return null;
	}
	
}
